package github.flandre.examplemod.common.enchantment;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentType;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;

public class ExampleEnchantment extends Enchantment {
    //Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType[] slots
    //稀有度  附魔类型  持有位置
    private static final EquipmentSlotType[] MAINHAD = new EquipmentSlotType[]{
            EquipmentSlotType.MAINHAND
    };
    public ExampleEnchantment() {
        //稀有度普通 附魔到剑上 主手
        super(Rarity.COMMON,EnchantmentType.WEAPON,MAINHAD);
    }

    public int getMinEnchantability(int enchantmentLevel) {
        //最小附魔等级
        return 1 + 10 * (enchantmentLevel - 1); //附魔属性的等级
    }

    public int getMaxEnchantability(int enchantmentLevel) {
        //最大附魔等级
        return super.getMinEnchantability(enchantmentLevel) + 50;
    }

    /**
     * Returns the maximum level that the enchantment can have.
     */
    public int getMaxLevel() {
        return 5;
    }

    @Override
    protected boolean canApplyTogether(Enchantment ench) {
        //和横扫之刃不能同时存在
        return super.canApplyTogether(ench) && Enchantments.SWEEPING != ench;
    }
}
